﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using bdxyit.com.RecruitmentAppSys.IDAL;
using bdxyit.com.RecruitmentAppSys.DALFactory;
using bdxyit.com.RecruitmentAppSys.Models;
using bdxyit.com.RecruitmentAppSys.ViewModels;
namespace bdxyit.com.RecruitmentAppSys.BLL
{
    public class FamilyInfoBLL
    {
        private static readonly IFamilyInfoDAL dal = bdxyit.com.RecruitmentAppSys.DALFactory.DataAccess.CreateFamilyInfo();
        /// <summary>
        /// 插入的家庭信息
        /// </summary>
        /// <returns></returns>
        public static bool CreateFamilyInfoList(FamilyInfo fi) 
        {
           return dal.InsertFamilyInfoList(fi);
        }

        /// <summary>
        /// 获取所有的家庭信息通过用户Id
        /// </summary>
        /// <returns></returns>
        public static List<FamilyInfo> GetFamilyInfoByUserId(string UserId) 
        {
            return dal.SelectFamilyInfoByUserId(UserId);
        }

       /// <summary>
       /// 编辑家庭信息
       /// </summary>
       /// <param name="UserId"></param>
       /// <param name="fid"></param>
       /// <returns></returns>
        public static FamilyInfo GetFamilyInfoByUserIdAndFid(string UserId, string fid)
        {
            return dal.SelectFamilyInfoByUserIdAndFid(UserId, fid);
        }

        /// <summary>
        /// 删除家庭信息
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public static bool  RemoveFamilyInfoByUserId(string userID)
        {
            return dal.DeleteFamilyInfoByUserId(userID);
        }


        /// <summary>
        /// 编辑家庭信息
        /// </summary>
        /// <param name="fi"></param>
        /// <returns></returns>
        public static bool EditFamilyInfoList(FamilyInfo fi)
        {
            return dal.UpdateFamilyInfo(fi);
        }
    }
}
